package com.yiqi.liebang.feature.news.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.UserInfoBo;
import com.yiqi.liebang.entity.bo.FriendBo;
import com.yiqi.liebang.entity.bo.IssuesBo;
import com.yiqi.liebang.entity.bo.PeopleBo;
import com.yiqi.liebang.feature.news.contract.IssuesContract;
import com.yiqi.liebang.feature.news.dependencies.issues.DaggerIssuesModelComponent;
import com.yiqi.liebang.feature.people.contract.PeopleContract;
import com.yiqi.liebang.feature.people.dependencies.people.DaggerPeopleModelComponent;
import com.yiqi.liebang.framework.api.ApiLib;
import com.yiqi.liebang.framework.api.UserApi;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;

public class IssuesModel implements IssuesContract.Model {

    @Inject
    UserApi api;


    @Inject
    public IssuesModel() {
        DaggerIssuesModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<List<IssuesBo>> getIssuesBo() {
        return api.getIssuesList().compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> getRefuseFriend(IssuesBo id) {
        return api.getRefuseFriend(id).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> getPassFriend(IssuesBo id) {
        return api.getPassFriend(id).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
